Let xcsv parser keep QStrings up for one more level.
authorRobert Lipe <robertlipe@gpsbabel.org>
Mon, 8 Oct 2018 23:20:45 +0000 (18:20 -0500)
committerRobert Lipe <robertlipe@gpsbabel.org>
Mon, 8 Oct 2018 23:20:45 +0000 (18:20 -0500)
xcsv.cc

diff --git a/xcsv.cc b/xcsv.cc
index ee147a927e480ac16c7c2c50a7390afff6121e59..d93aec2067b2157127f5f301f1195d5013007e59 100644 (file)
--- a/xcsv.cc
+++ b/xcsv.cc
@@ -413,16 +413,13 @@ xcsv_parse_style_buff(const char* sbuff)
 static void
 xcsv_read_style(const char* fname)
 {
-  char* sbuff;
-
   xcsv_file_init();
 
   gbfile* fp = gbfopen(fname, "rb", MYNAME);
-  while ((sbuff = gbfgetstr(fp))) {
-    sbuff = lrtrim(sbuff);
+  for  (QString sbuff = gbfgetstr(fp); !sbuff.isNull(); sbuff = gbfgetstr(fp)) {
+    sbuff = sbuff.trimmed();
     xcsv_parse_style_line(sbuff);
   }
-  while (!gbfeof(fp));
 
   /* if we have no output fields, use input fields as output fields */
   if (xcsv_file.ofield_ct == 0) {